<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>viewOrder</title>
    <link rel="StyleSheet" href="/css/jpetstore.css" type="text/css" media="screen"/>
</head>
<body>
<div th:replace="common/top">
</div>

<div id="Content">
    <div id="BackLink">
        <a href="main">Return to Main Menu</a>
    </div>

    <div id="Catalog">

        <table>
            <tr>
                <td th:text="'ORDER '+${now_order.orderId}" align="center" >Order #</td>
                    <td th:text="${now_order.orderDate}"
                        pattern="yyyy/MM/dd hh:mm:ss" >
                        now_order.orderDate
                    </td>
            </tr>
            <tr>
                <th colspan="2">Payment Details</th>
            </tr>
            <tr>
                <td>Card Type:</td>
                <td th:text="${now_order.cardType}" ></td>
            </tr>
            <tr>
                <td>Card Number:</td>
                <td th:text="${now_order.creditCard}" ></td>
            </tr>
            <tr>
                <td>Expiry Date (MM/YYYY):</td>
                <td th:text="${now_order.expiryDate}" ></td>
            </tr>
            <tr>
                <th colspan="2">Billing Address</th>
            </tr>
            <tr>
                <td>First name:</td>
                <td th:text="${now_order.billToFirstName}"></td>
            </tr>
            <tr>
                <td>Last name:</td>
                <td th:text="${now_order.billToLastName}"></td>
            </tr>
            <tr>
                <td>Address 1:</td>
                <td th:text="${now_order.billAddress1}"></td>
            </tr>
            <tr>
                <td>Address 2:</td>
                <td th:text="${now_order.billAddress2}"></td>
            </tr>
            <tr>
                <td>City:</td>
                <td th:text="${now_order.billCity}"></td>
            </tr>
            <tr>
                <td>State:</td>
                <td th:text="${now_order.billState}"></td>
            </tr>
            <tr>
                <td>Zip:</td>
                <td th:text="${now_order.billZip}"></td>
            </tr>
            <tr>
                <td>Country:</td>
                <td th:text="${now_order.billCountry}"></td>
            </tr>
            <tr>
                <th colspan="2">Shipping Address</th>
            </tr>
            <tr>
                <td>First name:</td>
                <td th:text="${now_order.shipToFirstName}"></td>
            </tr>
            <tr>
                <td>Last name:</td>
                <td th:text="${now_order.shipToLastName}"></td>
            </tr>
            <tr>
                <td>Address 1:</td>
                <td th:text="${now_order.shipAddress1}"></td>
            </tr>
            <tr>
                <td>Address 2:</td>
                <td th:text="${now_order.shipAddress2}"></td>
            </tr>
            <tr>
                <td>City:</td>
                <td th:text="${now_order.shipCity}"></td>
            </tr>
            <tr>
                <td>State:</td>
                <td th:text="${now_order.shipState}"></td>
            </tr>
            <tr>
                <td>Zip:</td>
                <td th:text="${now_order.shipZip}"></td>
            </tr>
            <tr>
                <td>Country:</td>
                <td th:text="${now_order.shipCountry}"></td>
            </tr>
            <tr>
                <td>Courier:</td>
                <td th:text="${now_order.courier}"></td>
            </tr>
            <tr>
                <td >Status:</td>
                <td th:text="${now_order.status}"></td>
            </tr>
            <tr>
                <td colspan="2">
                    <table>
                        <tr>
                            <th>Item ID</th>
                            <th>Description</th>
                            <th>Quantity</th>
                            <th>Price</th>
                            <th>Total Cost</th>
                        </tr>
                            <tr th:each="lineItem:${now_order.getLineItems()}">
                                <td><a th:text="${lineItem.item.itemId}" th:href="@{'/catalog/viewItem?itemId='+${lineItem.item.itemId}}">
                                </a></td>
                                    <td th:if="${lineItem.item!=null}" th:text="${lineItem.item.attribute1}+
                                                 ${lineItem.item.attribute2}+
                                                 ${lineItem.item.attribute3}+
                                                 ${lineItem.item.attribute4}+
                                                 ${lineItem.item.attribute5}+
                                                 ${lineItem.item.product.name}"></td>
                                <td th:if="${lineItem.item==null}">
                                    <i>{description unavailable}</i>
                                </td>

                                <td th:text="${lineItem.quantity}">cartItem.quantity</td>
                                <td th:text="${lineItem.item.listPrice}" pattern="$#,##0.00"></td>
                                <td th:text="${lineItem.total}" pattern="$#,##0.00"></td>
                            </tr>
                        <tr>
                            <th colspan="3">Total:
                            <td th:text="${now_order.totalPrice}" pattern="$#,##0.00" ></td>
                            </th>
                        </tr>
                    </table>
                </td>
            </tr>

        </table>

    </div>
</div>

<div th:replace="common/bottom">
</div>
</body>
</html>